package com.jbm.jbmsupplier;

import android.app.DownloadManager;
import android.content.Context;
import android.net.Uri;
import android.os.Environment;

/**
 * Created by JBMhaier on 2017/2/20.
 */

public class UpdateVersion {
    public UpdateVersion(Context c, String url){
        DownloadManager manager = (DownloadManager) c.getSystemService(c.DOWNLOAD_SERVICE);
        //注意 这里的url就是请求地址 如:http://****.****.com/index.php/Api/Initialize/downloadNewVersionMember
        DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
        request.setMimeType("application/vnd.android.package-archive");
        request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "JBM.apk");
        manager .enqueue(request);

    }

}
